package com.example.daojia.frametest.Retrofit;

import com.example.daojia.frametest.Interface.MyApi;

import java.util.HashMap;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by zhangbin on 2018/7/25.
 */

public class UserHelper {
    public static Observable<String> login(String mobile, String password, String validateCode,
                                           String lat, String lng) {
        HashMap<String, String> params = new HashMap<>();
        params.put("mobile", mobile);
        params.put("password", password);
        params.put("validateCode", validateCode);
        params.put("lat", lat);
        params.put("lng", lng);
        params.put("gpsType", String.valueOf(1));
        params.put("r", Math.random() + "");
        return TSRtrofit.getInstance().createApi(MyApi.class)
                .goLogin(params)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());

    }

    public static Observable<String> getDriver(String id) {
        return TSRtrofit.getInstance().createApi(MyApi.class)
                .getDriver(id)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
